####################################
# Main effect RDD
####################################

rm(list=ls())

library(Hmisc)
library(ggplot2)
library(stargazer)
library(foreign)
library(rdrobust)
library(rdd)
library(readstata13)

################
# Prepare data 
################

# reada data
d = read.dta13("~/Dropbox/Anti-american attitudes/01_data/clean_data/trump_election_data_clean_final.dta")   
names(d)

# new score
d$score2 = d$score^2
d$score3 = d$score^3

######################
# ITT Trust
######################

reg1 = lm(d$us_trust_bin ~ d$treatment + d$score + d$treatment*d$score + as.factor(d$pais))
summary(reg1)

reg2 = lm(d$us_trust_bin ~ d$treatment + d$score + d$treatment*d$score + d$score2 + d$treatment*d$score2 + as.factor(d$pais))
summary(reg2)

reg3 = lm(d$us_trust_bin ~ d$treatment + d$score + d$treatment*d$score + d$score2 + d$treatment*d$score2 + d$score3 + d$treatment*d$score3 + as.factor(d$pais))
summary(reg3)

